package mail.fetch.qq;

import mail.util.FileManager;

import java.net.CookieManager;
import java.nio.charset.Charset;
import java.util.List;

import static com.han.http.util.Print.printlnInfo;

/**
 * @Author: Hanjiafeng
 * @Date: 2019-1-14 15:44:24
 * @Desc: 程序入口
 */
public class QqEntrance {
    public static void main(String... args) throws Exception {
        /*String[] proxy = "49.64.55.3:16666".split(":");
        System.setProperty("http.proxyHost", proxy[0]);
        System.setProperty("https.proxyHost", proxy[0]);
        System.setProperty("http.proxyPort", proxy[1]);
        System.setProperty("https.proxyPort", proxy[1]);*/
        t1();
    }

    private static void t1() throws Exception {
        Login11 login = new Login11("", null);
        String account = "".replaceAll("\n", "");
        CookieManager cookieManager = login.getCookieManager(account, "");

        Inbox11 inbox = new Inbox11(cookieManager);
        List<QqMailEntity> qqMailEntityList = inbox.getMailListDuringHalfYear();
        for (QqMailEntity entity : qqMailEntityList) {
            printlnInfo(entity);
            FileManager.overwrite("F:\\CreditBill\\" + entity.getSubject().replace("转发: ", "")
                    + ".html", entity.getContent(), Charset.forName("gb2312"));
        }
    }
}